{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Heatmap of Day Ahead LMPs\n", "\n", "In this example, we will download today's LMP prices at each of the CAISO trading hubs. We will then plot the prices on a heatmap." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import gridstatus" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Get LMPs\n", "\n", "We can use the gridstatus method to download LMP prices from CAISO" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "iso = gridstatus.CAISO()\n", "\n", "df = iso.get_lmp(\n", " date=\"today\", # you can change to desired date\n", " market=\"DAY_AHEAD_HOURLY\",\n", " locations=[\n", " \"TH_NP15_GEN-APND\",\n", " \"TH_SP15_GEN-APND\",\n", " \"TH_ZP26_GEN-APND\",\n", " ], # you can change to desired locations\n", ")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "next, let's clean up the data" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "# Convert to Hour Ending\n", "df[\"Hour\"] = df[\"Time\"].dt.hour + 1\n", "\n", "# Better names for locations\n", "df[\"Location\"] = df[\"Location\"].map(\n", " {\n", " \"TH_NP15_GEN-APND\": \"NP15\",\n", " \"TH_SP15_GEN-APND\": \"SP15\",\n", " \"TH_ZP26_GEN-APND\": \"ZP26\",\n", " }\n", ")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Make Heatmap\n", "\n", "We can make the heatmap by using the builtin heatmap visualization function" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "image/svg+xml": "458456453455457497573568506475468436435430446525588600595585585570499462445441439440442487565543446392369367359358387491559600568559556544485451442439438438440483559545449387340338354354400492561600567557556543480445123456789101112131415161718192021222324ZP26SP15NP15350400450500550600Day-Ahead Location Marginal Prices on 12/22/2022 ($/MWh)Hour Ending" }, "metadata": {}, "output_type": "display_data" } ], "source": [ "fig = gridstatus.viz.dam_heat_map(df)\n", "fig.show(\"svg\", width=1200, height=400)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3.10.2 64-bit ('isodata')", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.2" }, "orig_nbformat": 4, "vscode": { "interpreter": { "hash": "49f14642123d0cc1afa9fa45716ed5f1e915189c28b01efe02a8b7ec3c0a3fce" } } }, "nbformat": 4, "nbformat_minor": 2 }